<template>
<div>
  <div style="background: red;position:fixed;;top: 0;left: 0">
    <div @click="currentTabComponent='Demo02_1'">1</div><br/>
    <div @click="currentTabComponent='Demo02_2'">2</div><br/>
  </div>
  <keep-alive>
    <component v-bind:is="currentTabComponent"></component>
  </keep-alive>
</div>
</template>

<script>
import Demo02_1 from "@/components/demo02/Demo02_1";
import Demo02_2 from "@/components/demo02/Demo02_2";
export default {
  components:{Demo02_1,Demo02_2},
name: "Demo02",
  data(){
    return{
      currentTabComponent:'Demo02_1'
    }
  }
}
</script>

<style scoped>

</style>